package String.exercise;

import java.util.Scanner;

public class Demo5 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个字符串");
        String st=sc.nextLine();
        char c = st.charAt(2);
        System.out.println(c);
        for (int i = 0; i < st.length(); i++) {
            char c1 = st.charAt(i);
            System.out.print(c1);
        }
        System.out.println();
        System.out.println("------------");
        char[] brr=st.toCharArray();
        for (int i = 0; i < st.length(); i++) {
            System.out.print(brr[i]);
        }
        System.out.println();
        System.out.println("请输入一个字符串:");
        String st2=sc.nextLine();
        System.out.println(st.equals(st2));
        char c1 = st2.charAt(2);
        System.out.println(c1);
        char[] chars = st2.toCharArray();
        for (int i = 0; i < st2.length(); i++) {
            System.out.print(chars[i]+" ");
        }
        System.out.println();
        String sp = st.substring(2);
        System.out.println(sp);
        String ss=st2.substring(2);
        System.out.println(ss);
        String ss1=st2.substring(1,3);
        System.out.println(ss1);

    }
}
